package cn.gx.learn.security_boot_jwt_websocket.websocket_origin.dal.mysql;

import cn.gx.learn.security_boot_jwt_websocket.websocket_origin.dal.database.Message;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;


@Mapper
public interface MessageMapper extends BaseMapper<Message> {

    default List<Message> selectOfflineMessage(Integer userId) {
        return selectList(new LambdaQueryWrapper<Message>()
                .eq(Message::getReceiverId,userId)
                .eq(Message::getStatus,0));
    };

    default List<Message> selectAllMessage(Integer userId) {

        return selectList(new LambdaQueryWrapper<Message>()
                .eq(Message::getReceiverId,userId));
    };



}
